<div class="row justify-content-center">
    <div class="col-8">
        <form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
            <h2 id="jhi-goods-heading" jhiTranslate="husenApp.goods.home.createOrEditLabel">Create or edit a Goods</h2>
            <div>
                <jhi-alert-error></jhi-alert-error>
                <div class="form-group" [hidden]="!goods.id">
                    <label for="id" jhiTranslate="global.field.id">ID</label>
                    <input type="text" class="form-control" id="id" name="id"
                        [(ngModel)]="goods.id" readonly />
                </div>
                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.name" for="field_name">Name</label>
                    <input type="text" class="form-control" name="name" id="field_name"
                        [(ngModel)]="goods.name" />
                </div>
                <div class="form-group" [hidden]="true">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.appid" for="field_appid">Appid</label>
                    <input type="text" class="form-control" name="appid" id="field_appid"
                        [(ngModel)]="goods.appid" />
                </div>
                <div class="form-group" [hidden]="true">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.openid" for="field_openid">Openid</label>
                    <input type="text" class="form-control" name="openid" id="field_openid"
                        [(ngModel)]="goods.openid" />
                </div>
                <div class="form-group" [hidden]="true">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.pic" for="field_pic">Pic</label>
                    <input type="text" class="form-control" name="pic" id="field_pic"
                        [(ngModel)]="goods.pic" />
                </div>
                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.picImg" for="field_picImg">Pic Img</label>
                    <div>
                        <img [src]="'data:' + goods.picImgContentType + ';base64,' + goods.picImg" style="max-height: 100px;" *ngIf="goods.picImg" alt="goods image"/>
                        <div *ngIf="goods.picImg" class="form-text text-danger clearfix">
                            <span class="pull-left">{{goods.picImgContentType}}, {{byteSize(goods.picImg)}}</span>
                            <button type="button" (click)="clearInputImage('picImg', 'picImgContentType', 'fileImage')" class="btn btn-secondary btn-xs pull-right">
                                <fa-icon [icon]="'times'"></fa-icon>
                            </button>
                        </div>
                        <input type="file" id="file_picImg" (change)="setFileData($event, goods, 'picImg', true)" accept="image/*" jhiTranslate="entity.action.addimage"/>
                    </div>
                    <input type="hidden" class="form-control" name="picImg" id="field_picImg"
                        [(ngModel)]="goods.picImg" />
                    <input type="hidden" class="form-control" name="picImgContentType" id="field_picImgContentType"
                        [(ngModel)]="goods.picImgContentType" />
                </div>
                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.miniPrice" for="field_miniPrice">Mini Price</label>
                    <input type="number" class="form-control" name="miniPrice" id="field_miniPrice"
                        [(ngModel)]="goods.miniPrice" />
                </div>
                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.orders" for="field_orders">Orders</label>
                    <input type="number" class="form-control" name="orders" id="field_orders"
                        [(ngModel)]="goods.orders" />
                </div>
                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.status" for="field_status">Status</label>
                    <select class="form-control" name="status" [(ngModel)]="goods.status" id="field_status" >
                        <option value="STATUSA">{{'husenApp.GoodsStatus.STATUSA' | translate}}</option>
                        <option value="STATUSB">{{'husenApp.GoodsStatus.STATUSB' | translate}}</option>
                    </select>
                </div>

                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="husenApp.goods.shop" for="field_shop">Shop</label>
                    <select class="form-control" id="field_shop" name="shop" [(ngModel)]="goods.shopId" >
                        <option [ngValue]="null"></option>
                        <option [ngValue]="shopOption.id" *ngFor="let shopOption of shops; trackBy: trackShopById">{{shopOption.id}}</option>
                    </select>
                </div>
            </div>
            <div>
                <button type="button" id="cancel-save" class="btn btn-secondary"  (click)="previousState()">
                    <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
                </button>
                <button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
                    <fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
                </button>
            </div>
        </form>
    </div>
</div>
